//
//  Singer.m
//  MyKara
//
//  Created by Buffalo on 1/30/15.
//  Copyright (c) 2015 Buffalo. All rights reserved.
//

#import "Singer.h"
#import "AppManager.h"
@implementation Singer

- (id)initSingerWithId:(NSString *)singerId {
    self = [super init];
    if (self) {
        NSDictionary *singer = [NSDictionary dictionaryWithDictionary:[AppUtils getSingerWithId:singerId]];
        self.name = [singer objectForKey:KEY_SINGER_NAME];
        self.avatar = [UIImage imageNamed:[singer objectForKey:KEY_SINGER_AVATAR]];
        self.singerId = [singer objectForKey:KEY_SINGER_ID];
        self.songList = [NSArray arrayWithArray:[AppUtils getSingerSongList:self.singerId]];
    }
    return self;
}

- (id)initSingerInArray:(NSArray *)singerList atIndex:(NSInteger)index {
    self = [super init];
    if (self) {
        NSDictionary *singer = [singerList objectAtIndex:index];
        self.name = [singer objectForKey:KEY_SINGER_NAME];
        self.avatar = [UIImage imageNamed:[singer objectForKey:KEY_SINGER_AVATAR]];
        self.singerId = [singer objectForKey:KEY_SINGER_ID];
        self.songList = [NSArray arrayWithArray:[AppUtils getSingerSongList:self.singerId]];
    }
    return self;
}
@end
